package accountManagementNew.config;

import accountManagementNew.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author：lihonbin
 * @Version：1.0.0
 * @Date:2025/9/24
 * @Description: 配置类
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    private final LoginInterceptor loginInterceptor;
    @Autowired // 只有一个的时可以忽略@Autowired
    public WebConfig(LoginInterceptor loginInterceptor) {
        this.loginInterceptor = loginInterceptor;
    }

//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        /**
//         * 添加拦截器
//         * addPathPatterns("/**")：添加拦截路径
//         * excludePathPatterns("/auth/login")：排除登录路径
//         */
//        registry.addInterceptor(loginInterceptor)
//                .addPathPatterns("/**")
//                .excludePathPatterns("/auth/login")
//                .excludePathPatterns("/swagger-ui.html")
//                .excludePathPatterns("/v3/api-docs")
//                .excludePathPatterns("/v3/api-docs/**")
//                .excludePathPatterns("/swagger-ui/**");
//    }
}